package com.guigu.dispatch.feign;

import com.guigu.order.entity.Order;
import com.guigu.order.entity.OrderLocation;
import com.guigu.order.entity.vo.OrderLocationVO;
import com.guigu.tms.result.R;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

/**
 * @ClassName:OrderFegin
 * @Description:订单服务远程调用
 * @Author:taoLong
 * @Date:2021/11/19:9:26 星期五
 * @email:2391611102@qq.com or 2391611102qq@gmail.com
 */
@FeignClient(name = "service-order", path = "/order")
public interface OrderFeign {


    /**
     * 查询订单状态是待取件并且是已付的状态
     *
     * @param status        订单状态
     * @param paymentStatus 付款状态
     * @return
     */
    @ApiOperation("查询订单状态是待取件并且是已付的状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "status", value = "订单状态"),
            @ApiImplicitParam(name = "paymentStatus", value = "付款状态")
    })
    @GetMapping("/order/getOrderList/{status}/{paymentStatus}")
    public List<Order> getOrderList(@PathVariable("status") Integer status,
                                    @PathVariable("paymentStatus") Integer paymentStatus);


    /**
     * 修改订单状态为待发车装填
     *
     * @return
     */
    @ApiOperation("修改订单状态为待发车装填")
    @PutMapping("/order/modifyOrderStatus/{id}")
    public R modifyOrderStatus(@PathVariable("id") String id);

    /**
     * 根据订单id查找订单位置信息
     *
     * @param id
     * @return
     */
    @ApiOperation("根据订单id查找订单位置信息")
    @ApiImplicitParam(name = "id", value = "订单Id")
    @GetMapping("/order-location/{id}")
    public R<OrderLocationVO> queryById(@PathVariable("id") String id);


    /**
     * 通过当前机构和目的机构来获取数据
     *
     * @param sendAgencyId 当前机构
     * @param receiveId    目的机构
     * @return
     */
    @ApiOperation("通过当前机构和目的机构来获取数据")
    @GetMapping("/order-location/{sendAgencyId}/{receiveId}")
    public R<List<OrderLocation>> queryOrderLocationBySendAgencyIdAndReceiveId(@PathVariable("sendAgencyId") String sendAgencyId, @PathVariable("receiveId") String receiveId);



    /**
     * 根据订单Id获取订单信息
     *
     * @param id
     * @return
     */
    @ApiOperation("根据订单Id获取订单信息")
    @GetMapping("/order/getOrderById/{id}")
    public Order getOrderById(@PathVariable("id") String id);
}
